﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Reflection;

namespace CDHunter
{
    class CheckBrandFactory
    {
        private static readonly string AssemblyName = "CDHunter";
        private static readonly String[] checkBrandNameList = ConfigurationSettings.AppSettings["CheckBrands"].Split('|');

        public static List<CheckBrand> GetCheckBrands()
        {
            List<CheckBrand> checkBrandList = new List<CheckBrand>();

            for (int i = 0; i < checkBrandNameList.Length; i++)
            {
                string checkBrandName = checkBrandNameList[i].Trim();
                if (!String.IsNullOrEmpty(checkBrandName))
                {
                    string className = AssemblyName + "." + checkBrandName;
                    CheckBrand cBrand = (CheckBrand)Assembly.Load(AssemblyName).CreateInstance(className);
                    checkBrandList.Add(cBrand);
                }
            }

            return checkBrandList;
        }
    }
}
